<?php
/**
 * Created by PhpStorm.
 * User: liuxiaojie
 * Date: 2019-03-06
 * Time: 12:35
 */

namespace app\model;

class MoneyLog extends BaseModel{


    public static $reason = [
      '1'=> '新用户扫码加余额',
      '2'=> '老用户扫码加虎牙',
      '3'=> '用户提现',
      '4'=> '用户提现失败，返还金额',
      '5'=> '充值钻石',
      '6'=> '开锁接单，扣钻石',
      '7'=> '修改服务类型，扣钻石',
      '8'=> '取消订单，返还定金',
      '9'=> '下单，减余额',
      '10'=> '认证成功，加钻石',
      '11'=> '手动加钻石',
      '12'=> '新用户扫码加虎牙',
      '13'=> '下单,给合伙人返现',
      '14'=> '下单,给合伙人返虎牙',
    ];

    static function addLog($data){

        $post = [
            'child_id'=> $data['child_id'],
            'u_id'=> $data['u_id'],
            'type'=> $data['type'],
            'value'=> $data['value'],
            'reason_type'=> $data['reason_type'],
            'reason'=> self::$reason[$data['reason_type']],
        ];

        db('money_log')->insert($post);

    }

}